﻿using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using K9Nano.Web.Accounts.Dto;

namespace K9Nano.Web.Accounts
{
    public interface IAccountAppService
    {
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellation"></param>
        /// <returns>新用户的ID</returns>
        ValueTask<Guid> CreateAsync(UserCreateInput input, CancellationToken cancellation);

        /// <summary>
        /// 获取用角色列表
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        ValueTask<IList<string>> GetRolesAsync(string id, CancellationToken cancellation);

        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        ValueTask AddRolesAsync(UserRoleEditInput input, CancellationToken cancellation);

        /// <summary>
        /// 移除角色
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        ValueTask RemoveRolesAsync(UserRoleEditInput input, CancellationToken cancellation);

        /// <summary>
        /// 更新用户基础信息
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        ValueTask UpdateBaseInfoAsync(UserEditInput input, CancellationToken cancellation);


        ValueTask<UserInfoDto> GetUserInfo();

        /// <summary>
        /// 禁止用户登录客户端
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        ValueTask ForbidAsync(UserWithClientsInput input, CancellationToken cancellation);

        /// <summary>
        /// 允许用户登录客户端
        /// </summary>
        /// <param name="input"></param>
        /// <param name="cancellation"></param>
        /// <returns></returns>
        ValueTask AllowAsync(UserWithClientsInput input, CancellationToken cancellation);
    }
}